Usage...
Dim lRetCrc as long
lRetCrc = vbCrC1.CrcCustomCalc("This
is my string", &h8408&, &hFFFF&, False, True)
The syntax of
the CrcCustomCalc method is similar to that of the other two methods, however it
takes some additional arguments. As was the case of the other methods it returns
a long value containing the calculated CRC value. All of it's arguments are
required parameters, and they are in order, the string to calculate, the
polynomial to use, the seed to use, A true/false parameter setting whether you
want a 32 bit return value, and a true/false parameter setting whether to use
the forward, or reverse algorithm.
In the above example the string that is
passed is 'This is my string'. Passing it false as the fourth parameter
indicates that we will be returning a 16 bit value as the CRC, and passing it
true as the fifth parameter indicates that we want to use the reversed CRC
algorithm. So therefore the value returned to lRetCrc would be the reversed 16
bit CRC calculation on the string 'This is my string', using the polynomial
0x8408, and the seed of 0xFFFF.
In actuallity the sample above will return
the same value as using CrcCalc with the CCITT Reversed algorithm, because the
that is actually what I defined with the options I passed to CrcCustomCalc. Now
if this all seems about as clear as mud to you, you may want to read the brief
explanation of crc calculation on this page.
NEW The
installation now also includes a dll file which can be used for applications
that do not wish to have a visual representation of the control. An example of
this would be an application which does not contain a Form. The DLL is still
very ßeta and has not been fully tested, however it should generate the correct
CRC's. The DLL can be used simply by adding a reference to it from the Project |
References menu. The file should be located in the windows system directory and
will be named vbcrc.dll. Once you have added the reference to the DLL it exposes
the two functions in the DLL as global functions to Visual Basic, meaning that
they can be used exactly as you would use Visual Basic's built in functions. The
two functions included in the DLL are the CrcCalc function and the CrcFileCalc
function. At this time the CrcCustomCalc has not been implemented in the DLL
version of vbCrC. If this is something you would like to see please email me to
let me know I can be reached via email at jhaase@iland.net